<script setup>
import { useUserStore } from "../../store/user.js";
let userStore = useUserStore();
userStore.storeInit();

function navigateTo(page) {
  window.location.href = `/src/pages/${page}`;
}
</script>

<template>
  <div class="container">
    <div class="header">
      <div class="title">苏小课直播教学平台</div>
      <div class="user-info" style="cursor:pointer;">
        <div class="notification" @click="navigateTo('messageCenter/messageCenter.html')">
          <i class="bell-icon">🔔</i>
          <span class="badge">3</span>
        </div>
        <div class="user">您好，{{ userStore.uname }}！</div>
        <div class="actions">
          <a href="/src/pages/userCenter/userCenter.html">个人中心</a> |
          <a href="./login.html">退出</a>
        </div>
      </div>
    </div>
    <div class="main-container">
      <div class="sidebar">
        <div class="profile">
          <img src="../../../images/猫和老鼠min.jpg" alt="Profile Picture" />
          <div class="name">{{ userStore.uname }}</div>
          <div class="major">{{userStore.identity}}</div>
          <div class="job-info">
            工作信息：
            <br />
            联系方式：{{userStore.phone}}
            <br />
            邮箱：{{userStore.email}}
          </div>
        </div>
      </div>
      <div class="main">
        <button class="nav-button">&lt;</button>
        <div class="cards">
          <div
            class="card"
            style="background-color: #d1ba74"
            id="createCabinet"
            @click="navigateTo('teacherClass/teacherClass.html')"
          >
            我的班级
            <!-- <span class="badge">1</span> -->
          </div>
          <div
            class="card"
            id="findPath"
            @click="navigateTo('myCourse/myCourse.html')"
            style="background-color: #8cc7b5"
          >
            我的课程
            <!-- <span class="badge">1</span> -->
          </div>
          <div
            class="card"
            id="preview"
            @click="navigateTo('Live/classList.html')"
            style="background-color: #e6ceac"
          >
            直播课堂
            <!-- <span class="badge">1</span> -->
          </div>
          <div
            class="card"
            style="background-color: #bee7e9"
            @click="navigateTo('resourceLibrary/resourceLibrary.html')"
          >
            资源库
          </div>
          <div
            class="card"
            style="background-color: #ecad9e"
            @click="navigateTo('messageCenter/messageCenter.html')"
          >
            消息中心
            <span class="badge">3</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<style>
:root {
  --industrial-blue: #1e90ff;
  --background-color: #f5f5f5;
  --white: #fff;
  --text-color: #333;
  --gray: #666;
  --border-color: #ddd;
  --highlight-color: #e0f7ff;
}

html,
body,
.container {
  height: 100%;
  margin: 0;
}

body {
  font-family: Arial, sans-serif;
  background-color: var(--background-color);
  display: flex;
  flex-direction: column;
  color: var(--text-color);
}

.container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background-color: var(--white);
  border-bottom: 1px solid var(--border-color);
}

.header .title {
  font-size: 24px;
  color: var(--industrial-blue);
}

.header .user-info {
  display: flex;
  align-items: center;
}

.header .user-info .notification {
  margin-right: 20px;
  position: relative;
}

.header .user-info .notification .badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: red;
  color: var(--white);
  border-radius: 50%;
  padding: 2px 5px;
  font-size: 12px;
}

.header .user-info .user {
  margin-right: 10px;
  color: var(--text-color);
}

.header .user-info .actions a {
  margin: 0 5px;
  color: var(--industrial-blue);
  text-decoration: none;
}

.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: 250px;
  background-color: var(--white);
  padding: 20px;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar .profile {
  text-align: center;
}

.sidebar .profile img {
  border-radius: 50%;
  width: 80px;
  height: 80px;
  margin-bottom: 10px;
}

.sidebar .profile .name {
  font-size: 18px;
  margin: 30px 0;
  color: var(--text-color);
}

.sidebar .profile .major {
  color: var(--gray);
  margin-bottom: 10px;
}

.sidebar .profile .report {
  color: var(--industrial-blue);
  cursor: pointer;
  text-decoration: none;
}

.main {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.cards {
  display: flex;
  gap: 50px;
  flex-wrap: wrap;
  justify-content: center;
}

.card {
  flex: 1;
  min-width: 200px;
  max-width: 250px;
  background-color: var(--white);
  text-align: center;
  padding: 60px 20px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  position: relative;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: box-shadow 0.3s ease;
}

.card .badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: red;
  color: var(--white);
  border-radius: 50%;
  padding: 2px 5px;
  font-size: 12px;
}

.card:hover {
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
  background-color: var(--highlight-color);
  border-color: var(--industrial-blue);
}

.nav-button {
  position: absolute;
  top: 50%;
  left: 250px;
  transform: translateY(-50%);
  background-color: var(--white);
  border: 1px solid var(--border-color);
  padding: 10px;
  cursor: pointer;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}
</style>
